#ifndef SCORESORT_H_INCLUDED
#define SCORESORT_H_INCLUDED
#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
 
namespace li
{
struct Stu
{
public:
    Stu(std::string n="", int score1=0, int score2=0, int score3=0) : 
     name(n),s1(score1),s2(score2),s3(score3),sum(s1+s2+s3){ }
    string getName()    const  {return name;}
    int getS1()  const  {return s1;  }
    int getS2()  const  {return s2;  }
    int getS3()  const  {return s3;  }
    int getSum() const  {return sum; }
    void disp()  const;
private:
    std::string name;
    int s1;
    int s2;
    int s3;
    int sum;
};
 
const char* const filename = "data.txt";
int  ReadStuList(const char *  filename, Stu* stuPtrs[]);
void DispStuList(Stu* stuPtr[],int n);
void StuSort(Stu* stuPtr[], int n, bool comp(const Stu* ,const Stu* ));
 
}
 
inline void li::Stu::disp() const
{
    cout <<setw(10) << name << setw(5) << s1 <<
    setw(5)<<s2 << setw(5) << s3 <<setw(8) << sum <<endl;
}
 
#endif // SCORESORT_H_INCLUDE

